<%-- 
    Document   : editagent
    Created on : May 15, 2012, 1:30:30 PM
    Author     : Jayson Kiong
--%>

<%@page import="Model.Agent"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel = "stylesheet" type = "text/css" href = "quicklendstyle.css"/>
        <script src="gen_validatorv4.js" type="text/javascript"></script>
        <title>JSP Page</title>
    </head>
    <body>
        <%
        Agent agent = (Agent)session.getAttribute("agent");
        %>
        <div id="contenttitle" style="position: absolute; top:13px; left:25px;">
            Edit Agent Information
        </div>
        <form id="editagentform" action="UpdateAgentServlet" method="POST">
            <table style="font-family:segoe ui; font-size:12px; position:absolute; top:70px; left:30px; filter:alpha(opacity=100)">
                        <tr>
                            <td><b>Agent Code</b></td><td><input type="text" style="width:150px;" name="agentcode" value="<%=agent.getStrAgentcode()%>"><div id='editagentform_agentcode_errorloc' style="color:#FF0000"></div></td>
                        </tr>
                        <tr>
                            <td>Name:</td><td><input type="text" style="width:150px;" name="name" value ="<%=agent.getStrName()%>"><div id='editagentform_name_errorloc' style="color:#FF0000"></div></td>
                        </tr>
                        
                        <tr>
                            <td>No. & Street:</td><td><input type="text" style="width:150px;" name="street" value="<%=agent.getStrStreet()%>"><div id='editagentform_street_errorloc' style="color:#FF0000"></div></td>
                        </tr>
                        <tr>
                            <td>Town/City/Province:</td><td><input type="text" style="width:150px;" name="city" value="<%=agent.getStrCity()%>"><div id='editagentform_city_errorloc' style="color:#FF0000"></div></td>
                        </tr>
                        <tr>
                            <td>Zip:</td><td><input type="text" style="width:150px;" name="zip" value="<%=agent.getiZip()%>"><div id='editagentform_zip_errorloc' style="color:#FF0000"></div></td>
                        </tr>
                        <tr>
                            <td>Email:</td><td><input type="text" style="width:150px" name="email" value="<%=agent.getStrEmail()%>"><div id='editagentform_email_errorloc' style="color:#FF0000"></div></td>
                        </tr>
                        <tr>
                            <td>Contact No.</td><td><input type="text" style="width:150px;" name="contact" value="<%=agent.getStrContact()%>"><div id='editagentform_contact_errorloc' style="color:#FF0000"></div></td>
                        </tr>
                        <tr>
                            <td>Remarks:</td><td><input type="text" style="width:150px;" name="remarks" value="<%=agent.getStrRemarks()%>"></td>
                        </tr>
                        <tr>
                            <td>Commission:</td><td><input type="text" style="width:150px;" name="commission" value="<%=agent.getfCommission()%>"><div id='editagentform_commission_errorloc' style="color:#FF0000"></div></td>
                        </tr>
                        <tr>
                            <td><input type="hidden" style="width:150px;" name="id" value="<%=agent.getiID()%>"></td>
                        </tr>
                        
                    </table>
                    <div id="agentfunction" style="position:absolute; top:500px; left:500px; font-family: segoe ui;">
                    <input type="image" src="images/saveimage.png" size="13" style="position:absolute; left:0px"/>
                    <a href="AgentServlet" class="precompcancelbtn" name="precompcancelbtn"  size="13" style="position:absolute; left:170px"/></a>
                    </div>
        </form>
    </body>
    <script type="text/javascript">
         var frmvalidator  = new Validator("editagentform");
         frmvalidator.addValidation("name","req","Please enter the Name"); 
         frmvalidator.addValidation("agentcode","req","Please enter the Agent Code");
         frmvalidator.addValidation("street","req","Please enter the Street");
         frmvalidator.addValidation("city","req","Please enter the City");
         frmvalidator.addValidation("email","req","Please enter the Email Address");
         frmvalidator.addValidation("email","email","Invalid Email Address");
         frmvalidator.addValidation("zip","req","Please enter the Zip");
         frmvalidator.addValidation("zip","num","Invalid Zip");
         frmvalidator.addValidation("contact","req","Please enter the Contact No.");
         frmvalidator.addValidation("commission","req","Please enter the Agent's Commission");
         frmvalidator.addValidation("commission","num","Invalid Agent's Commission");
         frmvalidator.addValidation("contact","num","Invalid contact no.");
         frmvalidator.EnableOnPageErrorDisplay();
         frmvalidator.EnableMsgsTogether();
    </script>
</html>
